#!/usr/bin/python
#
# Copyright 2011 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""GIT login request

Defines login request protobuffer.
"""

__author__ = 'Xin Zhou(zhounew@google.com)'

from git.data import git_account

class GitLoginRequest:
  def __init__(self, email, password):
    self.email_ = email
    self.password_ = password
    self.domain_federated_ = False
    self.account_ = None
  
  def GetEmail(self):
    return self.email_
  
  def GetPassword(self):
    return self.password_
  
  def SetAccount(self, account):
    self.account_ = account
  
  def GetAccount(self):
    return self.account_
  
  def SetDomainFederated(self, email_federated):
    self.domain_federated_ = email_federated
  
  def GetDomainFederated(self):
    return self.domain_federated_
  
  def GetAccountType(self):
    if self.account_:
      return self.account_.GetAccountType()
    else:
      if self.domain_federated_:
        return git_account.GitAccount.FEDERATED
      else:
        return git_account.GitAccount.LEGACY